package com.example.monitoringsystem.service.error;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.example.monitoringsystem.bean.Doctor;
import com.example.monitoringsystem.bean.Patient;
import com.example.monitoringsystem.bean.User;
import com.example.monitoringsystem.mapper.DoctorMapper;
import com.example.monitoringsystem.mapper.PatientMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Wrapper;
import java.util.List;
@Transactional
@Service
public class Doctorinformationservice {

    @Autowired
    private DoctorMapper doctorMapper;
/*    //获取医生的信息
    public Doctor finddoctorbyid() {
        QueryWrapper<Doctor> wrapper = new QueryWrapper<Doctor>();
        int id = Util.getCurrentUser().getId();
        wrapper.eq("doctor_id", id);
        Doctor doctor = doctorMapper.selectOne(wrapper);
        return doctor;
    }

    public void updatdescription(String description) {
        UpdateWrapper<Doctor> wrapper = new UpdateWrapper<>();
        int id = Util.getCurrentUser().getId();
        wrapper.set("description", description)
                .eq("doctor_id", id);
    }*/
}



//@Service
//@Transactional
////public class Doctorinformationservice implements UserDetailsService {
//    @Autowired
//    DoctorMapper doctorMapper;
//    @Override
//    public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
//       Doctor doctor=doctorMapper.selectUsers((Wrapper) new QueryWrapper<Patient>().eq("email", email));
//        if (doctor == null) {
//            //避免返回null，这里返回一个不含有任何值的User对象，在后期的密码比对过程中一样会验证失败
//            return (UserDetails) new Patient();
//        }
//        //查询用户的角色信息，并返回存入user中
//        return (UserDetails) doctor;
//    }
//    //查找用户的信息
//
//        public Doctor findUserByAccount(String account) {
//            QueryWrapper<Doctor> wrapper = new QueryWrapper<Doctor>();
//            wrapper.eq("email", account);
//        Doctor doctor=doctorMapper.selectOne(wrapper);
//        return doctor;
//    }
//    //修改用户的密码
//    public void updateStu(String password,String email) {
//        doctorMapper.updatedocotor(new UpdateWrapper<>().set("password", password).eq("email", email));
//    }
//    //修改用户名
//    public void updatename(String name,String email) {
//        doctorMapper.updatedocotor(new UpdateWrapper<>().set("username", name).eq("email", email));
//    }
//    //  修改年龄
//    public void updateage(int age ,String email) {
//       doctorMapper.updatedocotor(new UpdateWrapper<>().set("age", age).eq("email", email));
//    }
//    //修改性别
//    public void updategender(char gender,String email) {
//        doctorMapper.updatedocotor(new UpdateWrapper<>().set("gender", gender).eq("email", email));
//    }
//    //更改医生描述
//    public void updatedescription(String description,String email) {
//        doctorMapper.updatedocotor(new UpdateWrapper<>().set("description", description).eq("email", email));
//
//    }
//}
